<!DOCTYPE html>
<html>
<head>
    <include file="Include:meta"/>
    <title>编辑项目-目的地运营集团数据管理平台</title>
    <include file="Include:style"/>
    <style>
        .w50 {
            width: 50px;
        }
    </style>
</head>
<body>
<include file="Include:header"/>
<include file="Include:left"/>
<div id="main">
    <div class="crumbs">
        <div class="crumbs-text">项目列表 > 编辑项目</div>
    </div>
    <div id="content">
        <form action="__APP__/CrmProjects/edit" method="post" id="crmprojects_form">
            <div class="form-main">
                <input hidden name="project_id" value="{$project_id}">
                <div class="form-title">编辑项目</div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>关联商务项目</div>
                    <div class="input-item">
                        <input type="text" class="form-control w400" value="{$result['project_name']}"
                               autocomplete="off" required readonly>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目编号</div>
                    <div class="input-item">
                        <input type="text" class="form-control w400" value="{$result['project_num']}" autocomplete="off"
                               readonly>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目名称</div>
                    <div class="input-item">
                        <input type="text" class="form-control w400" value="{$result['project_name']}"
                               autocomplete="off" readonly>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目简称</div>
                    <div class="input-item">
                        <input type="text" class="form-control w400" name="short_name" value="{$result['short_name']}" autocomplete="off">
                        <span class="error-item">必填项</span>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>关联部门</div>
                    <div class="input-item">
                        <select name="department_id" class="form-control w400 required_select" autocomplete="off"
                                required>
                            <foreach name="res_department" item="vo">
                                <option value="{$vo['DEPTID']}"
                                <if condition="$result['department_id'] eq $vo['DEPTID']">selected</if>
                                >{$vo['HPS_DEPT_FULLDESCR']}</option>
                            </foreach>
                        </select>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目负责人</div>
                    <div class="input-item">
                        <select name="leader" class="form-control w200 required_select" autocomplete="off"
                                required>
                            <foreach name="user_list" item="vo">
                                <option value="{$vo.id}"
                                <if condition="$result['leader'] eq $vo['id']">selected</if>
                                >{$vo.username}</option>
                            </foreach>
                        </select>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目群负责人</div>
                    <div class="input-item">
                        <select name="group_leader" class="form-control w200 required_select" autocomplete="off"
                                required>
                            <foreach name="user_list" item="vo">
                                <option value="{$vo.id}"
                                <if condition="$result['group_leader'] eq $vo['id']">selected</if>
                                >{$vo.username}</option>
                            </foreach>
                        </select>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>添加联系人</div>
                    <div class="input-item">
                        <select name="main_linkman" class="form-control w200"
                                autocomplete="off" required>
                            <option value="-10">请选择</option>
                            <foreach name="res_contact" item="vo">
                                <option value="{$vo['contact_id']}"
                                <if condition="$result['main_linkman'] eq $vo['contact_id']">selected</if>
                                >{$vo['username']}-{$vo['mobilephone']}</option>
                            </foreach>
                        </select>
                        <button type="button" class="btn add_cus" refresh=0>添加客户</button>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>启动日期</div>
                    <div class="input-item">
                        <input type="text" name="start_date" class="form-control Wdate w100 required_text"
                               onClick="WdatePicker()" autocomplete="off" value="{$result['start_date']}" readonly><span
                            class="error-item">必填项</span>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label">备注</div>
                    <div class="input-item">
                        <textarea name="remark" class="form-control w400"
                                  autocomplete="off">{$result['remark']}</textarea>
                    </div>
                </div>
            </div>
            <div class="form-btn-item"><input type="submit" value="提交" class="btn btn-submit">
                <button class="btn btn-default goback" type="button">返回</button>
            </div>
        </form>
    </div>
</div>
<!--弹出框-->
<include file="Crm:contact_ajax_add"/>
</body>
<include file="Include:javascript"/>
<include file="Crm:javascript_contact"/>
<script>
    $(function () {
        /*省市联动*/
        $("[name='province_id']").change(function () {
            var id = $(this).val();
            $.ajax({
                type: "POST",
                dataType: 'json',
                data: {'region': id, 'type': 1, 'bool': 1},
                url: "__APP__/Communal/get_province_city",
                success: function (data) {
                    var option = "";
                    if (data) {
                        option += "<option value='-10'>请选择</option>";
                        if (data) {
                            for (var i = 0; i < data.length; i++) {
                                option += "<option value=" + data[i].id + ">" + data[i].name + "</option>";
                            }
                        }
                    } else {
                        option += "<option value='-10'>市</option>";
                    }
                    $("[name='city_id']").html(option).select2();
                }
            });
        });
    });
</script>
</html>